package com.common.demo.juejin;

import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: hua
 * @Date: 2023/05/29 18:12
 * @version: v1.0
 * @Description: TODO
 */
@RestController
@RequestMapping("/api/v1/users")
public class TeacherAdminController {

    @GetMapping
    public R list() {
        Teacher t=null;
        if (1 == 1) {
            System.out.println(t.getName());
            int i = 0 / 0;
            throw new CMSException(500, "错误");
        }

        List<Teacher> list = new ArrayList<>();
        list.add(new Teacher("张三"));
        return R.ok().data("itms", list).message("用户列表");
    }

    @AllArgsConstructor
    @Data
    class Teacher {
        private String name;
    }
}
